package com.zr.quotation.service.impl;

import com.zr.planclass.util.ResultBuilderVo;
import com.zr.planclass.util.ResultVo;
import com.zr.quotation.mapper.QuotationMapper;
import com.zr.quotation.model.QuotationServiceVo;
import com.zr.quotation.model.QuotationVo;
import com.zr.quotation.service.QuotationService;
import com.zr.util.AllRecords;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created by lenovo on 2020/1/2.
 */
@Service
public class QuotationServiceImpl implements QuotationService{
    @Autowired
    private QuotationMapper quotationMapper;

    @Override
    public ResultVo quotationList(QuotationServiceVo quotationServiceVo) {
        List<QuotationVo> list = quotationMapper.queryPartnerData(quotationServiceVo);
        System.out.println(list);
        int count = quotationMapper.queryPartnerCount(quotationServiceVo);//queryPartnerCount
        AllRecords allRecords = new AllRecords();
        allRecords.setDataList(list);
        allRecords.setPageSize(quotationServiceVo.getPageSize());
        allRecords.setPageIndex(quotationServiceVo.getPageIndex());
        allRecords.setTotalNumber(count); //总共的条数
        allRecords.resetTotalNumber(count); //计算总页数
        return ResultBuilderVo.success(allRecords);

    }
}
